#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

static void lets_fork(void);

int main(int argc, char *argv[]) {
    pid_t mypid = getpid();
    uid_t myuid = getuid();
    printf("pid: %d\n", mypid);
    printf("uid: %d\n", myuid);
    printf("\n");
    lets_fork();

    return EXIT_SUCCESS;
}

static void lets_fork(void) {
    pid_t pid;
    if ((pid = fork()) < 0) {
        printf("error when fork\n");
        exit(EXIT_FAILURE);
    } else if (pid == 0) {
        printf("child  pid: %d\n", getpid());
        sleep(5);
    } else {
        printf("parent pid: %d\n", getpid());
        sleep(100);
    }
}
